<!DOCTYPE html>
<html lang="en">
<head>
<title>WebView4Delphi: uWVCoreWebView2SharedBuffer: Class TCoreWebView2SharedBuffer</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="PasDoc 0.16.0-snapshot">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<span id="TCoreWebView2SharedBuffer"></span><h1 class="cio">Class TCoreWebView2SharedBuffer</h1>
<div class="sections">
<div class="one_section"><a class="section" href="#PasDoc-Description">Description</a></div><div class="one_section"><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></div><div class="one_section"><a class="section" href="#PasDoc-Fields">Fields</a></div><div class="one_section"><a class="section" href="#PasDoc-Methods">Methods</a></div><div class="one_section"><a class="section" href="#PasDoc-Properties">Properties</a></div></div>
<span id="PasDoc-Description"></span><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="uWVCoreWebView2SharedBuffer.html">uWVCoreWebView2SharedBuffer</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TCoreWebView2SharedBuffer = class(TObject)</code></p>
<h2 class="description">Description</h2>
<p>
 The shared buffer object that is created by CreateSharedBuffer. The object is presented to script as ArrayBuffer when posted to script with PostSharedBufferToScript. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer</a>&quot;&gt;See the ICoreWebView2SharedBuffer article.)

<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environment12#createsharedbuffer">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environment12#createsharedbuffer</a>&quot;&gt;See the CreateSharedBuffer article.)

<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_17#postsharedbuffertoscript">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_17#postsharedbuffertoscript</a>&quot;&gt;See the PostSharedBufferToScript article.)</p>
<span id="PasDoc-Hierarchy"></span><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TObject</li>
<li class="thisitem">TCoreWebView2SharedBuffer</li></ul><h2 class="overview">Overview</h2>
<span id="PasDoc-Fields"></span><h3 class="summary">Fields</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code><strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#FBaseIntf">FBaseIntf</a></strong>: <a href="uWVTypeLibrary.ICoreWebView2SharedBuffer.html">ICoreWebView2SharedBuffer</a>;</code></td>
</tr>
</table>
<span id="PasDoc-Methods"></span><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetInitialized">GetInitialized</a></strong>: boolean;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetSize">GetSize</a></strong>: Largeuint;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetBuffer">GetBuffer</a></strong>: PByte;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetOpenStream">GetOpenStream</a></strong>: IStream;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetFileMappingHandle">GetFileMappingHandle</a></strong>: HANDLE;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#InitializeFields">InitializeFields</a></strong>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#Create-ICoreWebView2SharedBuffer-">Create</a></strong>(const aBaseIntf : <a href="uWVTypeLibrary.ICoreWebView2SharedBuffer.html">ICoreWebView2SharedBuffer</a>); reintroduce;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>destructor <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#Destroy">Destroy</a></strong>; override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#Close">Close</a></strong>: boolean;</code></td>
</tr>
</table>
<span id="PasDoc-Properties"></span><h3 class="summary">Properties</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#Initialized">Initialized</a></strong>        : boolean                    read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetInitialized">GetInitialized</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#BaseIntf">BaseIntf</a></strong>           : <a href="uWVTypeLibrary.ICoreWebView2SharedBuffer.html">ICoreWebView2SharedBuffer</a>  read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#FBaseIntf">FBaseIntf</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#Size">Size</a></strong>               : Largeuint                  read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetSize">GetSize</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#Buffer">Buffer</a></strong>             : PByte                      read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetBuffer">GetBuffer</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#OpenStream">OpenStream</a></strong>         : IStream                    read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetOpenStream">GetOpenStream</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <strong><a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#FileMappingHandle">FileMappingHandle</a></strong>  : HANDLE                     read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetFileMappingHandle">GetFileMappingHandle</a>;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Fields</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="FBaseIntf"></span><code><strong>FBaseIntf</strong>: <a href="uWVTypeLibrary.ICoreWebView2SharedBuffer.html">ICoreWebView2SharedBuffer</a>;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="GetInitialized"></span><code>function <strong>GetInitialized</strong>: boolean;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="GetSize"></span><code>function <strong>GetSize</strong>: Largeuint;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="GetBuffer"></span><code>function <strong>GetBuffer</strong>: PByte;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="GetOpenStream"></span><code>function <strong>GetOpenStream</strong>: IStream;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="GetFileMappingHandle"></span><code>function <strong>GetFileMappingHandle</strong>: HANDLE;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><span id="InitializeFields"></span><code>procedure <strong>InitializeFields</strong>;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Create-ICoreWebView2SharedBuffer-"></span><code>constructor <strong>Create</strong>(const aBaseIntf : <a href="uWVTypeLibrary.ICoreWebView2SharedBuffer.html">ICoreWebView2SharedBuffer</a>); reintroduce;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Destroy"></span><code>destructor <strong>Destroy</strong>; override;</code></td>
</tr>
<tr><td colspan="2">
<p class="nodescription">This item has no description.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Close"></span><code>function <strong>Close</strong>: boolean;</code></td>
</tr>
<tr><td colspan="2">
<p>


<p>Release the backing shared memory. The application should call this API when no access to the buffer is needed any more, to ensure that the underlying resources are released timely even if the shared buffer object itself is not released due to some leaked reference.

<p>After the shared buffer is closed, the buffer address and file mapping handle previously obtained becomes invalid and cannot be used anymore. Accessing properties of the object will fail with `RO_E_CLOSED`. Operations like Read or Write on the IStream objects returned from `OpenStream` will fail with `RO_E_CLOSED`. `PostSharedBufferToScript` will also fail with `RO_E_CLOSED`.

<p>The script code should call `chrome.webview.releaseBuffer` with the shared buffer as the parameter to release underlying resources as soon as it does not need access the shared buffer any more.

<p>When script tries to access the buffer after calling `chrome.webview.releaseBuffer`, JavaScript `TypeError` exception will be raised complaining about accessing a detached ArrayBuffer, the same exception when trying to access a transferred ArrayBuffer.

<p>Closing the buffer object on native side doesn't impact access from Script and releasing the buffer from script doesn't impact access to the buffer from native side. The underlying shared memory will be released by the OS when both native and script side release the buffer.

<p></p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#close">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#close</a>&quot;&gt;See the ICoreWebView2SharedBuffer article.)</p>
</td></tr>
</table>
<h3 class="detail">Properties</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Initialized"></span><code>property <strong>Initialized</strong>        : boolean                    read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetInitialized">GetInitialized</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Returns true when the interface implemented by this class is fully initialized. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="BaseIntf"></span><code>property <strong>BaseIntf</strong>           : <a href="uWVTypeLibrary.ICoreWebView2SharedBuffer.html">ICoreWebView2SharedBuffer</a>  read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#FBaseIntf">FBaseIntf</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Returns the interface implemented by this class. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Size"></span><code>property <strong>Size</strong>               : Largeuint                  read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetSize">GetSize</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
 The size of the shared buffer in bytes. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#get_size">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#get_size</a>&quot;&gt;See the ICoreWebView2SharedBuffer article.)</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Buffer"></span><code>property <strong>Buffer</strong>             : PByte                      read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetBuffer">GetBuffer</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
 The memory address of the shared buffer. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#get_buffer">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#get_buffer</a>&quot;&gt;See the ICoreWebView2SharedBuffer article.)</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="OpenStream"></span><code>property <strong>OpenStream</strong>         : IStream                    read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetOpenStream">GetOpenStream</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Get an IStream object that can be used to access the shared buffer. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#openstream">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#openstream</a>&quot;&gt;See the ICoreWebView2SharedBuffer article.)</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="FileMappingHandle"></span><code>property <strong>FileMappingHandle</strong>  : HANDLE                     read <a href="uWVCoreWebView2SharedBuffer.TCoreWebView2SharedBuffer.html#GetFileMappingHandle">GetFileMappingHandle</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>


<p>Returns a handle to the file mapping object that backs this shared buffer. The returned handle is owned by the shared buffer object. You should not call CloseHandle on it.

<p>Normal app should use `Buffer` or `OpenStream` to get memory address or IStream object to access the buffer.

<p>For advanced scenarios, you could use file mapping APIs to obtain other views or duplicate this handle to another application process and create a view from the duplicated handle in that process to access the buffer from that separate process.

<p></p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#get_filemappinghandle">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2sharedbuffer#get_filemappinghandle</a>&quot;&gt;See the ICoreWebView2SharedBuffer article.)</p>
</td></tr>
</table>
<hr><span class="appinfo"><em>Generated by <a href="https://pasdoc.github.io/">PasDoc 0.16.0-snapshot</a>. </em>
</span>
</body></html>
